<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0">

	<xsl:param name="guide"/>
	<xsl:param name="component"/>

	<xsl:template match="/">
		<xsl:choose>
			<xsl:when test="$component = 'null'">
				<b>
					<xsl:value-of select="//filedesc/titlestmt/titleproper"/>
				</b>
			</xsl:when>
			<xsl:otherwise>
				<a href="/orbeon/ead/?guide={$guide}">
					<xsl:value-of select="//filedesc/titlestmt/titleproper"/>
				</a>
			</xsl:otherwise>
		</xsl:choose>
		<br/>
		<br/>
		<div style="text-align:center">
			<h4>List of Components</h4>
		</div>
		<ul>
			<xsl:apply-templates select="descendant::dsc/c"/>
		</ul>
	</xsl:template>

	<xsl:template match="c">
		<li>
			<xsl:choose>
				<xsl:when test="@id = $component">
					<b>
						<xsl:value-of select="did/unittitle"/>
					</b>
				</xsl:when>
				<xsl:otherwise>
					<a href="/orbeon/ead/c/?guide={$guide}&amp;component={@id}">
						<xsl:value-of select="did/unittitle"/>
					</a>
				</xsl:otherwise>
			</xsl:choose>
			<xsl:if test="c">
				<ul>
					<xsl:apply-templates select="c"/>
				</ul>
			</xsl:if>
		</li>
	</xsl:template>

</xsl:stylesheet>
